<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<meta http-equiv="X-UA-Compatible" content="IE=edge,Chrome=1">
		<!-- Google Chrome Frame也可以让IE用上Chrome的引擎: -->
		<meta name="renderer" content="webkit">
		<!--国产浏览器高速模式-->
		<meta name="viewport" content="width=device-width, initial-scale=1">
		<meta name="author" content="穷在闹市" />
		<!-- 作者 -->
		<meta name="revised" content="穷在闹市.v3, 2019/05/01" />
		<!-- 定义页面的最新版本 -->
		<meta name="description" content="网站简介" />
		<!-- 网站简介 -->
		<meta name="keywords" content="搜索关键字，以半角英文逗号隔开" />
		<title>穷在闹市出品</title>

		<!-- 公共样式 开始 -->
		<link rel="stylesheet" type="text/css" href="/admin/css/base.css">
		<link rel="stylesheet" type="text/css" href="/admin/css/iconfont.css">
		<script type="text/javascript" src="/admin/framework/jquery-1.11.3.min.js"></script>
		<link rel="stylesheet" type="text/css" href="/admin/layui/css/layui.css">
		<script type="text/javascript" src="/admin/layui/layui.js"></script>
		<!-- 滚动条插件 -->
		<link rel="stylesheet" type="text/css" href="/admin/css/jquery.mCustomScrollbar.css">
		<script src="/admin/framework/jquery-ui-1.10.4.min.js"></script>
		<script src="/admin/framework/jquery.mousewheel.min.js"></script>
		<script src="/admin/framework/jquery.mCustomScrollbar.min.js"></script>
		<script src="/admin/framework/cframe.js"></script><!-- 仅供所有子页面使用 -->
		<!-- 公共样式 结束 -->


	</head>

	<body>
		<div class="cBody">
            <!-- 模糊查询 -->
            <form class="layui-form" action="" method="get">
                <div class="layui-form-item">
                    <div class="layui-input-inline">
                        <input type="text" name="search" value="{{$AgentSearch}}" placeholder="输入分管名称" autocomplete="off" class="layui-input">
                    </div>
                    <input type="submit" class="layui-btn" lay-submit lay-filter="formDemo" value="检索">

                    <button><a href="/agentadd_admin" class="layui-btn">添加</a></button>
                </div>
            </form>
            <!-- 模糊查询 结束 -->

            <form class="layui-form" action="">

				<table id="customList" class="layui-table">
					<thead>
						<tr>
							<th>头像</th>
							<th>经纪人名称</th>
							<th>联系电话</th>
							<th>所属门店</th>
                            <th>经纪人推荐</th>
                            <th>所属区域</th>
							<th>操作</th>
						</tr>
					</thead>
					<tbody>
                    <!-- 经纪人遍历 -->
                    @foreach($AgentRows as $v)
						<tr>
							<td><img src="{{$v->agent_picture}}" style="width:60px;height:60px;"></td>
							<td>{{$v->agent_name}}</td>
							<td>{{$v->agent_tel}}</td>
                            <td>{{$v->agent_store}}</td>
                            <td>{{$v->agent_recommend}}</td>
							<td>{{\App\Libraries\helpers::cityName($v->agent_city)}}</td>
							<td>
                                <a href="/agent_detele/?id={{$v->agent_id}}" class="layui-btn">删除</a>
                                <a href="/agentedit_admin/?id={{$v->agent_id}}" class="layui-btn">修改</a>
                            </td>
						</tr>
                    @endforeach
                    <!-- 经纪人遍历 结束 -->
                    </tbody>
				</table>
			</form>

            <!-- layUI 分页模块 -->
            <div id="pages"></div>
            <script>
                layui.use(['laypage', 'layer'], function() {
                    var laypage = layui.laypage,
                        layer = layui.layer;

                    //总页数大于页码总数
                    laypage.render({
                        elem: 'pages'
                        ,limit: {{$m}}
                        ,count: {{$AgentCount}}
                        ,curr: {{$page}}
                        ,prev: '吊上一个'
                        ,next: '吊下一个'
                        ,layout: ['count', 'prev', 'page', 'next', 'limit', 'skip']
                        ,jump: function(obj,first){
                            if (!first) {
                                location.href = "/agent_admin/?" + "page=" + obj.curr+'&&'+'search='+"{{$AgentSearch}}";
                            }
                        }
                    });
                });
            </script>
		</div>
		<script>
			//根据2018.03.01日 张家港客户需求改版的要求，在新的后台框架中提供以下功能
			//此功能只适用与提前加载后，进行搜索；

			//新增
			function addCustomList(id){
				var str = '<tr>'+
							'<td>'+
							    '<select class="newSelectSearch" name="modules" lay-verify="required" lay-search="" lay-filter="selectFilter">'+
						          '<option value="">直接选择或搜索选择</option>'+
						        '</select>'+
							'</td>'+
							'<td>'+
							    '<input type="tel" name="phone" lay-verify="required" autocomplete="off" class="layui-input">'+
							'</td>'+
							'<td>'+
							    '<input type="tel" name="phone" lay-verify="required" autocomplete="off" class="layui-input">'+
							'</td>'+
							'<td>'+
							    '<input type="tel" name="phone" lay-verify="required" autocomplete="off" class="layui-input">'+
							'</td>'+
							'<td>'+
							    '<input type="tel" name="phone" lay-verify="required" autocomplete="off" class="layui-input">'+
							'</td>'+
							'<td>'+
							    '<input type="tel" name="phone" lay-verify="required" autocomplete="off" class="layui-input">'+
							'</td>'+
							'<td>'+
								'<a class="layui-btn layui-btn-xs" onclick="delCustomList(this)">删除</a>'+
							'</td>'+
						'</tr>';
				$("#"+id).append(str);

				layui.use(['form','laydate'], function() {
					var form = layui.form;
					form.render();
				});
				//重新初始化Iframe的高度
				cframeInit();
			}

			//删除
			function delCustomList(_this){
				layui.use(['form','laydate'], function() {
					layer.confirm('确定要删除么？', {
						btn: ['确定', '取消'] //按钮
					}, function() {
						$(_this).parent().parent().remove();
						layer.msg('删除成功', {
							icon: 1
						});
					}, function() {
						layer.msg('取消删除', {
							time: 2000 //20s后自动关闭
						});
					});
				});
			}

		</script>
	</body>

</html>
